package com.huang.auth.converter;

import com.huang.auth.entity.po.AuthResourcePO;
import com.huang.auth.entity.request.AuthResourceAddRequest;
import com.huang.base.core.BaseConvertor;
import com.huang.utils.ObjectIdUtils;
import org.springframework.stereotype.Component;

@Component
public class AuthResourceRequestTOAuthResourcePO extends BaseConvertor<AuthResourceAddRequest, AuthResourcePO> {

    @Override
    public AuthResourcePO doConvert(AuthResourceAddRequest m) {
        AuthResourcePO authResourcePO = new AuthResourcePO();
        authResourcePO.setCode(m.getCode());
        authResourcePO.setName(m.getName());
        authResourcePO.setDescribe(m.getDescribe_());
        authResourcePO.setId(ObjectIdUtils.getInstance().nextId());
        authResourcePO.setMethod(m.getMethod());
        authResourcePO.setUrl(m.getUrl());
        authResourcePO.setCreateUser(Long.parseLong(m.getCreateUser()));
        authResourcePO.setUpdateUser(Long.parseLong(m.getCreateUser()));
        return authResourcePO;
    }
}
